﻿Imports System.ComponentModel 'nUEVO

Public Class COrden
    Implements INotifyPropertyChanged 'Nuevo

    Private _strContrato As String
    Private _strTipoValor As String
    Private _strEmisora As String
    Private _strSerie As String
    Private _strTitulos As String
    Private _strTipoOperacion As String
    Private _strPrecio As String
    Private _strLimitYield As String
    Private _strMonto As String
    Private _strSecuritySN As String
    Private _strMaturityRange As String
    Private _strMesa As String
    Private _strEstrategia As String
    Private _strTasa As String
    Private _strFechaLiquidacion As String
    Private _strMensaje As String
    Private _blnEsEditableNuevo As Boolean

    Private _columnas(15) As Object

    Public Event PropertyChanged(sender As Object, e As System.ComponentModel.PropertyChangedEventArgs) Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged

    Private Sub NotificarCambio(propname As String)
        RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propname))
    End Sub

    Default Property Columnas(ByVal index As Integer) As String
        Get
            Return _columnas(index)
        End Get
        Set(ByVal value As String)

            Try
                Select Case index
                    Case 0
                        Me.Contrato = value
                        NotificarCambio("Contrato")
                    Case 1
                        Me.TipoValor = value
                        NotificarCambio("TipoValor")
                    Case 2
                        Me.Emisora = value
                        NotificarCambio("Emisora")
                    Case 3
                        Me.Serie = value
                        NotificarCambio("Serie")
                    Case 4
                        Me.Titulos = value
                        NotificarCambio("Titulos")
                    Case 5
                        Me.TipoOperacion = value
                        NotificarCambio("TipoOperacion")
                    Case 6
                        Me.Precio = value
                        NotificarCambio("Precio")
                    Case 7
                        Me.LimitYield = value
                        NotificarCambio("LimitYield")
                    Case 8
                        Me.Monto = value
                        NotificarCambio("Monto")
                    Case 9
                        Me.SecuritySN = value
                        NotificarCambio("SecuritySN")
                    Case 10
                        Me.MaturityRange = value
                        NotificarCambio("MaturityRange")
                    Case 11
                        Me.Mesa = value
                        NotificarCambio("Mesa")
                    Case 12
                        Me.Estrategia = value
                        NotificarCambio("Estrategia")
                    Case 13
                        Me.Tasa = value
                        NotificarCambio("Tasa")
                    Case 14
                        Me.FechaLiquidacion = value
                        NotificarCambio("FechaLiquidacion")
                    Case 15
                        Me.Mensaje = value
                        NotificarCambio("Mensaje")
                End Select

            Catch ex As Exception
                Throw ex
            End Try

        End Set
    End Property

    Public Shared Function ValorInicalColumna(ByVal index As Integer) As Object
        Select Case index
            Case 0
                Return ""
            Case 1
                Return ""
            Case 2
                Return ""
            Case 3
                Return ""
            Case 4
                Return ""
            Case 5
                Return ""
            Case 6
                Return ""
            Case 7
                Return ""
            Case 8
                Return ""
            Case 9
                Return ""
            Case 10
                Return ""
            Case 11
                Return ""
            Case 12
                Return ""
            Case 13
                Return ""
            Case 14
                Return ""
            Case 15
                Return ""
            Case Else
                Return Nothing
        End Select
    End Function

    Public Sub New()
        _blnEsEditableNuevo = False
        _strMensaje = ""
    End Sub

    Public Sub New(ByVal C As String, ByVal TV As String, ByVal E As String, ByVal S As String, ByVal Tit As String, ByVal TOp As String, ByVal P As String, ByVal L As String, ByVal M As String, ByVal SSN As String, ByVal MR As String, ByVal Mesa As String, ByVal Est As String, ByVal T As String, ByVal F As String)
        _strContrato = C
        _strTipoValor = TV
        _strEmisora = E
        _strSerie = S
        _strTitulos = Tit
        _strTipoOperacion = TOp
        _strPrecio = P
        _strLimitYield = L
        _strMonto = M
        _strSecuritySN = SSN
        _strMaturityRange = MR
        _strMesa = Mesa
        _strEstrategia = Est
        _strTasa = T
        _strFechaLiquidacion = F
        _blnEsEditableNuevo = False
        _strMensaje = ""

        Columnas(0) = _strContrato
        Columnas(1) = _strTipoValor
        Columnas(2) = _strEmisora
        Columnas(3) = _strSerie
        Columnas(4) = _strTitulos
        Columnas(5) = _strTipoOperacion
        Columnas(6) = _strPrecio
        Columnas(7) = _strLimitYield
        Columnas(8) = _strMonto
        Columnas(9) = _strSecuritySN
        Columnas(10) = _strMaturityRange
        Columnas(11) = _strMesa
        Columnas(12) = _strEstrategia
        Columnas(13) = _strTasa
        Columnas(14) = _strFechaLiquidacion
        Columnas(15) = _strMensaje
    End Sub

    Public Property EsEditableNuevo As Boolean
        Get
            EsEditableNuevo = Me._blnEsEditableNuevo
        End Get
        Set(value As Boolean)
            Me._blnEsEditableNuevo = value
        End Set
    End Property

    Public Property Contrato As String
        Get
            Return _strContrato
        End Get
        Set(value As String)
            _strContrato = value
            _columnas(0) = _strContrato
            NotificarCambio("Contrato")
        End Set
    End Property

    Public Property TipoValor As String
        Get
            Return _strTipoValor
        End Get
        Set(value As String)
            _strTipoValor = value
            _columnas(1) = _strTipoValor
            NotificarCambio("TipoValor")
        End Set
    End Property

    Public Property Emisora As String
        Get
            Return _strEmisora
        End Get
        Set(value As String)
            _strEmisora = value
            _columnas(2) = _strEmisora
            NotificarCambio("Emisora")
        End Set
    End Property

    Public Property Serie As String
        Get
            Return _strSerie
        End Get
        Set(value As String)
            _strSerie = value
            _columnas(3) = _strSerie
            NotificarCambio("Serie")
        End Set
    End Property

    Public Property Titulos As String
        Get
            Return _strTitulos
        End Get
        Set(value As String)
            _strTitulos = value
            _columnas(4) = _strTitulos
            NotificarCambio("Titulos")
        End Set
    End Property

    Public Property TipoOperacion As String
        Get
            Return _strTipoOperacion
        End Get
        Set(value As String)
            _strTipoOperacion = value
            _columnas(5) = _strTipoOperacion
            NotificarCambio("TipoOperacion")
        End Set
    End Property

    Public Property Precio As String
        Get
            Return _strPrecio
        End Get
        Set(value As String)
            _strPrecio = value
            _columnas(6) = _strPrecio
            NotificarCambio("Precio")
        End Set
    End Property

    Public Property LimitYield As String
        Get
            Return _strLimitYield
        End Get
        Set(value As String)
            _strLimitYield = value
            _columnas(7) = _strLimitYield
            NotificarCambio("LimitYield")
        End Set
    End Property

    Public Property Monto As String
        Get
            Return _strMonto
        End Get
        Set(value As String)
            _strMonto = value
            _columnas(8) = _strMonto
            NotificarCambio("Monto")
        End Set
    End Property

    Public Property SecuritySN As String
        Get
            Return _strSecuritySN
        End Get
        Set(value As String)
            _strSecuritySN = value
            _columnas(9) = _strSecuritySN
            NotificarCambio("SecuritySN")
        End Set
    End Property

    Public Property MaturityRange As String
        Get
            Return _strMaturityRange
        End Get
        Set(value As String)
            _strMaturityRange = value
            _columnas(10) = _strMaturityRange
            NotificarCambio("MaturityRange")
        End Set
    End Property

    Public Property Mesa As String
        Get
            Return _strMesa
        End Get
        Set(value As String)
            _strMesa = value
            _columnas(11) = _strMesa
            NotificarCambio("Mesa")
        End Set
    End Property

    Public Property Estrategia As String
        Get
            Return _strEstrategia
        End Get
        Set(value As String)
            _strEstrategia = value
            _columnas(12) = _strEstrategia
            NotificarCambio("Estrategia")
        End Set
    End Property

    Public Property Tasa As String
        Get
            Return _strTasa
        End Get
        Set(value As String)
            _strTasa = value
            _columnas(13) = _strTasa
            NotificarCambio("Tasa")
        End Set
    End Property

    Public Property FechaLiquidacion As String
        Get
            Return _strFechaLiquidacion
        End Get
        Set(value As String)
            _strFechaLiquidacion = value
            _columnas(14) = _strFechaLiquidacion
            NotificarCambio("FechaLiquidacion")
        End Set
    End Property

    Public Property Mensaje As String
        Get
            Return _strMensaje
        End Get
        Set(value As String)
            _strMensaje = value
            _columnas(15) = _strMensaje
            NotificarCambio("Mensaje")
        End Set
    End Property
End Class
